/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.appspot.ittrick.drive.trick.bind;

import com.appspot.ittrick.drive.trick.task.FileDownloadTask;
import com.appspot.ittrick.drive.trick.task.FileUploadTask;
import javafx.beans.binding.BooleanBinding;

/**
 *
 * @author takahara
 */
public class FileTransmissionVisibleBinding extends BooleanBinding {
    
    private FileUploadTask fileUploadTask;
    private FileDownloadTask fileDownloadTask;
    
    /**
     * コンストラクタ
     */
    public FileTransmissionVisibleBinding(FileUploadTask fileUploadTask, FileDownloadTask fileDownloadTask) {
        this.fileUploadTask = fileUploadTask;
        this.fileDownloadTask = fileDownloadTask;
        
        super.bind(fileUploadTask.runningProperty());
        super.bind(fileDownloadTask.runningProperty());
    }

    @Override
    protected boolean computeValue() {
        if(fileUploadTask.runningProperty().getValue()) return true;
        if(fileDownloadTask.runningProperty().getValue()) return true;

        return false;
    }
    
}
